<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改登录密码</title>
<meta name="keywords" content="animals and pets, free website templates, CSS templates, free download" />
<meta name="description" content="Free CSS Template, free website template for animals and pets websites" />
<script type="text/javascript" src="${request.contextPath}/static/js/jquery-1.11.1.min.js"></script>
<link href="${request.contextPath}/static/css/templatemo_style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/packages/charts/classic/charts.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/packages/charts/classic/classic/resources/charts-all.css" rel="stylesheet" />
<style type="text/css">
html {
	background: url(${request.contextPath}/static/images/index/templatemo_html_bg.jpg) repeat;
}
.checkmsg{
color:red;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
	$('.lastpwd').focus();
	});

function toSubmit(){
	var lastPwd = document.getElementById("lastpwd").value;
	var newpwd = document.getElementById("newpwd").value;
	var renewpwd = document.getElementById("renewpwd").value;
	if(newpwd!=renewpwd){
		alert("新密码前后不一致，请重新输入！");
		return false;
	}
	$.ajax({
		url:"/user/changePassword",
		type:"post",
		data:{"lastPwd":lastPwd,"newpwd":newpwd},
		dataType:"json",
		success:function(result){
			if(result.status=='0'){
				alert(result.msg);
			}else{
				alert(result.msg);
				window.location.href="/login";
			}
		},
		error:function(){
			alert("校验旧密码发生异常");
		}
	});
}

</script>
</head>
<body>
<div>
<p>旧密码:<input type="text" name="lastpwd" id="lastpwd"/></p>
<p>新密码:<input type="text" name="newpwd" id="newpwd"/></p>
<p>确认密码:<input type="text" name="renewpwd" id="renewpwd"/></p>
<p><input type="submit" id="submit" onclick="toSubmit()" value="提交修改"/></p>
</div>
</body>
</html>